import { CDItemData } from "../../cache/CDItem/CDItemData";
import { BitmapDataPool } from "../../../common/pools/BitmapDataPool";
type int = number;
//class FreezingEffect
    
    export  class FreezingEffect extends ItemCD
    {
        constructor()
        {
            super();
            mouseChildren = false;
            mouseEnabled = false;
            return;
        }

        public get isCDPlaying(): Boolean
        {
            return this._cdTime && this._cdTime.isCoolDown;
        }

        public get cdTime(): CDItemData
        {
            return this._cdTime;
        }

        public setMaskSize(arg1: number, arg2: number): void
        {
            if (this._maskBitmap == null) 
            {
                this._maskBitmap = new Object /* flash.display.Bitmap */();
            }
            if (!(this._maskBitmap.width == arg1) || !(this._maskBitmap.height == arg2)) 
            {
                this._maskBitmap.bitmapData = BitmapDataPool.getMaskBitmapData(arg1, arg2);
            }
            this._maskBitmap.x = (-arg1) / 2;
            this._maskBitmap.y = (-arg2) / 2;
            this.addChild(this._maskBitmap);
            this.mask = this._maskBitmap;
            return;
        }

        public set cdTime(arg1: CDItemData)
        {
            this.clearEffect();
            this._cdTime = arg1;
            this._cdTime.addEffect(this);
            return;
        }

        public onCDEffectHandler(arg1: int): void
        {
            this.gotoAndStop(arg1);
            if (arg1 > 100) 
            {
                this.dispatchEvent(new Object /* flash.events.Event */(flash.events.Event.COMPLETE));
                this.clearEffect();
            }
            return;
        }

        public clearEffect(): void
        {
            if (this._cdTime) 
            {
                this._cdTime.removeEffect(this);
            }
            this._cdTime = null;
            this.gotoAndStop(1);
            return;
        }

        /* internal */ /* var */_cdTime: CDItemData;

        /* internal */ /* var */_maskBitmap: Object /* flash.display.Bitmap */;
    }
